package com.popcap.widgets;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Type
{
	private String name;
	private int id;
	private Map<String, String> methods = new HashMap<String, String>();
	private List<Property> properties = new ArrayList<Property>();
	private Map<String,Boolean> options = new HashMap<String, Boolean>();
	
	public Type(int id, String name)
	{
		this.id = id;
		this.name = name;
	}
	
	public String getName()
	{
		return name;
	}
	public void setName(String name)
	{
		this.name = name;
	}
	public int getId()
	{
		return id;
	}
	public void setId(int id)
	{
		this.id = id;
	}
	public Map<String, String> getMethods()
	{
		return methods;
	}
	
	public void setMethod(String name, String target)
	{
		this.methods.put(name, target);
	}
	
	public String getMethod(String name)
	{
		return this.methods.get(name);
	}
	
	public List<Property> getProperties()
	{
		return properties;
	}
	
	public void addProperty(String name, String type, String defaultValue)
	{
		this.properties.add(new Property(name, type, defaultValue));
	}
	
	public Map<String, Boolean> getOptions()
	{
		return options;
	}
	public void setOption(String name, String value)
	{
		this.options.put(name, "true".equalsIgnoreCase(value));
	}
}
